package com.itheima.Demo01.demo03;

import java.io.*;

public class SockeT {
    public static void main(String[] args) throws IOException {
        java.net.Socket S = new java.net.Socket("127.0.0.1", 10010);
        BufferedInputStream bis = new BufferedInputStream(
                new FileInputStream("D:\\网络测试.jpg"));
        BufferedOutputStream Bos =
                new BufferedOutputStream(S.getOutputStream());
        byte[] arr = new byte[1024 * 8];
        int len;
        while ((len = bis.read(arr)) != -1) {
          Bos.write(arr,0,len);
          Bos.flush();
        }
        S.shutdownOutput();
        bis.close();
        BufferedReader BR = new BufferedReader(new InputStreamReader(S.getInputStream()));
        String s = BR.readLine();
        System.out.println(s);
        BR.close();
        S.close();
    }
}
